package com.axin.system.controller;

import com.axin.common.core.domain.web.AjaxResult;
import com.axin.system.api.domain.SysUser;
import com.axin.system.service.ISysMenuService;
import com.axin.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * 权限管理 控制接口层
 *
 * @Author axin
 * @Date 2021/10/21 22:36
 **/
@RestController
@RequestMapping("/perm")
public class SysPermissionController {


    @Autowired
    private ISysMenuService sysMenuService;

    /**
     * 通过用户名查询用户
     *
     * @param userId 用户ID
     * @return 用户对象信息
     */
    @GetMapping("/get/{userId}")
    public AjaxResult<Set<String>> getMenuPermission(@PathVariable("userId") Long userId) {

        Set<String> perms = sysMenuService.selectMenuPermsByUserId(userId);

        return AjaxResult.success(perms);
    }
}
